﻿using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Threading;

namespace Sub2EXO
{
	// Token: 0x02000002 RID: 2
	public partial class App : Application
	{
		// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
		public App()
		{
			base.DispatcherUnhandledException += this.Application_DispatcherUnhandledException;
			AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException;
		}

		// Token: 0x06000002 RID: 2 RVA: 0x00002084 File Offset: 0x00000284
		private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
		{
			Exception ex = e.ExceptionObject as Exception;
			MessageBox.Show("很抱歉，当前应用程序遇到一些无法恢复的问题，程序即将关闭.", "意外的操作", MessageBoxButton.OK, MessageBoxImage.Hand);
			Environment.Exit(0);
		}

		// Token: 0x06000003 RID: 3 RVA: 0x000020B8 File Offset: 0x000002B8
		private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
		{
			Exception exception = e.Exception;
			MessageBox.Show("很抱歉，当前应用程序遇到一些问题，当前操作已终止.", "意外的操作", MessageBoxButton.OK, MessageBoxImage.Asterisk);
			e.Handled = true;
		}

		// Token: 0x06000004 RID: 4 RVA: 0x000020E8 File Offset: 0x000002E8
		private void CrashLog(string message)
		{
			string str = Environment.CurrentDirectory + "\\CrashLog\\";
			string text = DateTime.Now.ToString().Replace(':', '-').Replace('/', '-');
			for (int i = 0; i < 100; i++)
			{
				string text2 = text;
				bool flag = i != 0;
				if (flag)
				{
					text2 = text2 + " (" + i.ToString() + ")";
				}
				bool flag2 = !File.Exists(str + text2 + ".log");
				if (flag2)
				{
					try
					{
						StreamWriter streamWriter = new StreamWriter(str + text2 + ".log", false);
						streamWriter.WriteLine(message);
						streamWriter.Close();
						break;
					}
					catch
					{
					}
				}
			}
		}
	}
}
